<?php

namespace App\Models\MainDB\WarOrder;

use Illuminate\Database\Eloquent\Model;

class WarOrder extends Model
{
    protected $table = 'ln_war_order';

    protected $fillable = [
        'id',
        'name',
        'time_from',
        'time_to',
        'add_time',
        'status',//1开启2关闭
        'advance_price',//本赛季战令价格
    ];

    public $timestamps = false;

    public function getTimeFromAttribute($value)
    {
        return date('Y-m-d H:i:s', $this->attributes['time_from']);
    }
    public function getTimeToAttribute($value)
    {
        return date('Y-m-d H:i:s', $this->attributes['time_to']);
    }

    public function war_order_detail()
    {
        return $this->hasMany('App\Models\MainDB\WarOrder\WarOrderDetail', 'war_order_id', 'id');
    }
}
